import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:guoshuyu_flutter_project/paper/back_up_buttons.dart';

class PaperAppBar extends StatelessWidget implements PreferredSizeWidget {
  final VoidCallback? onBack;
  final VoidCallback? onRevocation;
  final VoidCallback onClear;
  const PaperAppBar(
      {super.key, required this.onClear, this.onBack, this.onRevocation});

  @override
  Widget build(BuildContext context) {
    return AppBar(
      centerTitle: true,
      elevation: 0,
      systemOverlayStyle: const SystemUiOverlayStyle(
          statusBarIconBrightness: Brightness.dark,
          statusBarColor: Colors.transparent),
      backgroundColor: Colors.white,
      leading: BackUpButtons(
        onBack: onBack,
        onRevocation: onRevocation,
      ),
      leadingWidth: 100,
      title: const Text(
        '画板绘制',
        style: TextStyle(color: Colors.black, fontSize: 16),
      ),
      actions: [
        IconButton(
            onPressed: onClear,
            icon: const Icon(
              Icons.delete_forever_rounded,
              color: Colors.black,
              size: 20,
            ))
      ],
    );
  }

  @override
  Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}
